#ifndef  __CONF_H_
#define  __CONF_H_
//怎么没有client_Id
#define DEF_BORKER_HOSTNAME        "iot-06z00i9k03hcz6s.mqtt.iothub.aliyuncs.com"
#define DEF_BROKER_PORT            1883
#define DEF_BROKER_KEEPALIVE       60
#define DEF_BROKER_USERNAME        "mqtt&h098jXhNP9d"
#define DEF_BROKER_PASSWD          "75a00f16f3102fbfb8a211a0dcd21dd9548c62b418b44478a04bd57c1f74b6bd"
#define DEF_BROKER_CLIENT_ID	   "h098jXhNP9d.mqtt|securemode=2,signmethod=hmacsha256,timestamp=1721637242760|"
#define DEF_PUBQOS                 0
#define DEF_PUBINTERVAL            3 /* 3 seconds */

#define DEF_SUBQOS                 0

#define MQTT_SYS_TOPIC             "$Sys/Studio/"
#define DEF_SUBTOPIC               "/sys/h098jXhNP9d/mqtt/thing/event/property/post_reply"
#define DEF_PUBTOPIC               "/sys/h098jXhNP9d/mqtt/thing/event/property/post"

enum
{
    Qos0, /* 发送者只发送一次消息，不进行重试，Broker不会返回确认消息。在Qos0情况下，Broker可能没有接受到消息 */
    Qos1, /* 发送者最少发送一次消息，确保消息到达Broker，Broker需要返回确认消息PUBACK。在Qos1情况下，Broker可能接受到重复消息 */
    Qos2, /* Qos2使用两阶段确认来保证消息的不丢失和不重复。在Qos2情况下，Broker肯定会收到消息，且只收到一次  */
};

typedef struct mqtt_ctx_s
{
    char          id[32];       /*  production ID */

    /* hardware configuration */
    //hwconf_t      hwconf;

    /* logger settings */
    char          logfile[128]; /* logger record file */
    int           loglevel;     /* logger level  */
    int           logsize;      /* logger file maxsize, oversize will rollback */

    /* Broker settings  */
    char          host[128];  /* MQTT broker server name  */
    int           port;       /* MQTT broker listen port  */
    char          uid[64];    /* username */
    char          pwd[64];    /* password */
    int           keepalive;  /* MQTT broker send PING message to subsciber/publisher keepalive timeout<seconds> */

    /* Publisher settings */
    char          pubTopic[256]; /* Publisher topic  */
    int           pubQos;        /* Publisher Qos */
    int           interval ;     /* Publish sensor data interval time, unit seconds */

    /* Subscriber settings */
    char          subTopic[256]; /* Subscriber topic */
    int           subQos;        /* Subscriber Qos  */
    char 	  clientId[256];

} mqtt_ctx_t;

extern int mqttd_parser_conf(const char *conf_file, mqtt_ctx_t *ctx, int debug);
#endif

